<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #msg{
            width: 100px;
            height: 100px;
            border: 1px solid #000;
            position: absolute;
        }
    </style>
</head>
<body>
    <button>请求</button>
    <div class="box" id="msg">跑马灯</div>
    <script>
        function creatXHR(){
            if(window.XMLHttpRequest){
                return new XMLHttpRequest();
            }
            return new ActiveXObject("Msxm12.XMLHTTP");
        }

        // 请求方式
        function ajax(url){
            let xhr=creatXHR();
            // 准备参数,默认指向异步:true
            xhr.open("get",url,false);
            xhr.send(null);
            return xhr.response;
        }

        var oBtn=document.querySelector("button");
        oBtn.onclick=function(){
            var res=ajax("http://useker.cn/person");
            console.log(res);
        }

        var oMsg=document.querySelector("#msg");
        setInterval(function(){
            oMsg.style.left=oMsg.offsetLeft+10+"PX";
            if(oMsg.offsetLeft>document.documentElement.clientWidth-oMsg.offsetWidth){
                oMsg.style.left="0px";
            }
        },60)
    </script>
</body>
</html>